package com.woniuxy.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class LogAspect{
    @Pointcut("execution(* com.woniuxy.service.impl.*.*(..))")
    public void poincut(){}
    @Before("poincut()")
    public void log(){
        System.out.println("====日志记录=======");
    }
    @AfterReturning("poincut()")
    public void release(){
        System.out.println("====释放资源=====");
    }
    @Around("poincut()")
    public Object round(ProceedingJoinPoint jp){
        Object obj=null;
        System.out.println("********之前***********");
        try {
            obj=jp.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        System.out.println("**********之后***********");
        return obj;

    }

}
